package georah.map.providers
{

	import georah.carto.Feature;
	import georah.carto.IGISClient;
	import georah.carto.geometries.OGCGeometry;
	import georah.map.layers.IFeatureLayerProvider;

	/**
	 *
	 * @author yuanm
	 */
	public class FeatureCollection implements IFeatureLayerProvider
	{
		private var _provider:Array=[];

		private var _result:Array=[];

		public function attributesN(n:int):Object
		{
			return Feature(_result[n]).attributes;
		}

		public final function get dataProvider():Array
		{
			return _provider;
		}

		[Bindable]
		public final function set dataProvider(value:Array):void
		{
			_provider=value;
		}

		public function get numFeatures():int
		{
			return _result.length;
		}

		public function shapeN(n:int):OGCGeometry
		{
			return Feature(_result[n]).shape;
		}

		public function update(view:IGISClient):void
		{
			_result=_provider;
		}

	}
}
